package com.deepocean.controller;

import com.deepocean.common.entity.ResultEntity;
import com.deepocean.entity.HierarchicalCycloneCondition;
import com.deepocean.entity.HierarchicalCycloneEntity;
import com.deepocean.service.IHierarchicalCycloneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 分级旋流器
 */
@RestController
@RequestMapping("/hierarchicalCyclone")
public class HierarchicalCycloneController {
    @Autowired
    private IHierarchicalCycloneService hierarchicalCycloneService;

    /**
     * 新增接口
     * @param hierarchicalCycloneEntity
     * @return
     */
    @PostMapping("/v1/add")
    public ResultEntity add(@RequestBody HierarchicalCycloneEntity hierarchicalCycloneEntity) {
        return ResultEntity.success(hierarchicalCycloneService.add(hierarchicalCycloneEntity));
    }

    /**
     * 一小时内物料输入输出总和
     * @param deviceId
     * @return
     */
    @PostMapping("/v1/getInAndOutInHour")
    public ResultEntity getInAndOutInHour(@RequestParam String deviceId) {
        return ResultEntity.success(hierarchicalCycloneService.getInAndOutInHour(deviceId));
    }

    /**
     * 条件查询
     * @param hierarchicalCycloneCondition
     * @return
     */
    @PostMapping("/v1/getHierarchicalCycloneByCondition")
    public ResultEntity getHierarchicalCycloneByCondition(@RequestBody HierarchicalCycloneCondition hierarchicalCycloneCondition) {
        return ResultEntity.success(hierarchicalCycloneService.getHierarchicalCycloneCondition(hierarchicalCycloneCondition));
    }

    /**
     * 根据设备型号获取理论数据
     * @return
     */
    @PostMapping("/v1/getTheoryData")
    public ResultEntity getTheoryData(String deviceType) {
        return ResultEntity.success("理论数据");
    }
}
